
/*
	封装库，获取基节点。对节点做最简单的处理
*/

//创建获取节点对象
var $ = function(){
	return new Base();
}

//获取节点分装方法
function Base() {
	
	this.elements = [];
	
	this.getId = function(id){
		this.elements.push(document.getElementById(id));
		return this;
	};
	
	this.getName = function(name){
		var tag = document.getElementsByName(name);
		
		for(var i=0;i<tag.length;i++){
			
			this.elements.push(tag[i]);
			
		}

		return this;
	};
	
	this.getTagName = function(tagname){
		var tag = document.getElementsByTagName(tagname);
		
		for(var i=0;i<tag.length;i++){
			
			this.elements.push(tag[i]);
			
		}

		return this;
	};
	
	this.getClassName = function (classname){
		var tag = document.getElementsByClassName(classname);
		
		for(var i=0;i<tag.length;i++){
			
			this.elements.push(tag[i]);
			
		}

		return this;
	};
	

}

//更改元素节点样式
Base.prototype.css = function (attrbute,value){
	
	for(var i=0;i<this.elements.length;i++){
		this.elements[i].style[attrbute] = value;
	}
	
	return this;
}

//更改html文本
Base.prototype.html = function(html){
	
	for(var i=0;i<this.elements.length;i++){
		this.elements[i].innerHTML=html;
	}
	
	return this;
	
}
//修改元素节点value值
Base.prototype.value = function(value){
	
	for(var i=0;i<this.elements.length;i++){
		this.elements[i].value=value;
	}
	
	return this;
	
}

	